package com.ruoyi.common.enums;

public enum InventoryStatus {
    PENDING(1, "待盘点"), 
    IN_PROGRESS(2, "盘点中"), 
    COMPLETED(3, "已完成");

    private final int code;
    private final String description;

    // 构造函数
    InventoryStatus(int code, String description) {
        this.code = code;
        this.description = description;
    }

    // 获取状态代码
    public int getCode() {
        return code;
    }

    // 获取状态描述
    public String getDescription() {
        return description;
    }


// 根据状态代码获取状态
    public static InventoryStatus fromCode(int code) {
        for (InventoryStatus status : InventoryStatus.values()) {
            if (status.getCode() == code) {
                return status;
            }
        }
        throw new IllegalArgumentException("Invalid code: " + code);
    }

    @Override
    public String toString() {
        return description;
    }
}
